package com.example.myapplication.module_common_service;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.myapplication.R;
import com.example.myapplication.data.FeedBack;

import java.util.Arrays;

public class DetailOfFeedBack extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail_of_feed_back);

        FeedBack feedBack = (FeedBack) getIntent().getExtras().get("feedBack");
        Log.d("get--------------------", "onCreate: "+feedBack);

        TextView title = findViewById(R.id.tv_fdTitle); title.setText(feedBack.getTitle());
        TextView date = findViewById(R.id.tv_fd_date); date.setText(feedBack.getDateTime());

        TextView reply = findViewById(R.id.tv_fd_reply); reply.setText(feedBack.getReply());
        if(feedBack.getReply().equals("")){
            reply.setText("暂无回复！！！");
        }
        TextView content = findViewById(R.id.tv_fd_content); content.setText(feedBack.getContent());
        LinearLayout area = findViewById(R.id.img_area);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            Arrays.stream(feedBack.getImgs()).forEach(
                    s -> {
                        ImageView imageView = new ImageView(this);
                        Glide.with(this).load("http://120.25.230.35:8080/imgs/"+s).into(imageView);
                        area.addView(imageView);
                    }
            );
        }
    }
}